import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AboutView from '../views/about/index.vue'
import ToplistView from '../views/about/ToplistView.vue'
import SingerView from '../views/about/SingerView.vue'

Vue.use(VueRouter)
const routes = [
    {
        path: '/home',
        name: 'home',
        component: HomeView
    },
    {
        path: '/about',
        name: 'about',
        component: AboutView,
        children:[
            {
                path: 'toplist',
                name: 'toplist',
                component: ToplistView
            },
            {
                path: 'singer',
                name: 'singer',
                component: SingerView
            }
        ]
    },
    //重定向，默认主页面为redirect的地址
    {
        path:'/',
        redirect:'/about/toplist'
    }
]
const router = new VueRouter({
    routes
})
export default router